<!DOCTYPE html>
<html lang="zh-cn">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
  <title>需求详情</title>


  <!-- Expand styles -->
  <link href="../css/app/app.css" rel="stylesheet">
  <link href="../css/app/default.css" rel="stylesheet">
  <link href="../css/mui/mui.css" rel="stylesheet">
  <link href="../css/mui/mui.picker.min.css" rel="stylesheet" />


  <!-- Custom styles for this template -->
  <!-- <link href="../css/iOS/mobile/mobile.css" rel="stylesheet"> -->
</head>

<body>

  <!-- header -->
  <div class="margin-b-60">
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训类型</span>
      <span id="tranType"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训主题</span>
      <span id="title"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训主办方</span>
      <span id="tranSponsors"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训时间</span>
      <span id="tranBeginTime"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训地点</span>
      <span id="tranAddress"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训人数</span>
      <span id="tranPeopleNum"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训预算</span>
      <span id="budget"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训联系人</span>
      <span id="tranConnectPersion"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训截止时间</span>
      <span id="quoteDeadline"></span>
    </div>
    <div class="display-flex justify-content-between align-items-center details-box">
      <span>培训描述</span>
      <span id="details"></span>
    </div>
  </div>
  <div id="offer_show">

  </div>


  <script src="../js/dsbridge.js"></script>
  <script src="../js/jquery.js"></script>
  <script src="../js/mui/mui.js"></script>
  <script src="../js/layer.js"></script>
  <script src="../js/app/app-base.js"></script>
  <script src="../js/app/app-url.js"></script>
  <script src="../js/app/app-ajax.js"></script>

  <script>
    var dataInfo;
    var id = getVal('tranDemand_Id');
    //页面来源 需求大厅 我的需求列表 我的报价列表 收藏
    //当页面来源为 我的需求列表 我的报价列表时 没有立即报价按钮
    var sourceType = localStorage.getItem("tranDemandDetail_sourceType");
    var object = {
      tranType: '',
      title: '',
      tranSponsors: '',
      tranBeginTime: '',
      tranAddress: '',
      tranPeopleNum: '',
      budget: '',
      tranConnectPersion: '',
      quoteDeadline: '',
      details: ''
    };

    $(document).ready(function () {
      var data = {
        id: id,
        userAccId: getUserId()
      }
      // 获取详情
      getServerData(url_trandemandmgr_queryDetail, data);


      //判断是否为培训机构
      if ( sourceType !== 'my-quote' && sourceType !== 'my-training') {
            $('#offer_show').html(
              `<div class="save-btn hobby-footer1">
                  <button type="button" class="mui-btn mui-btn-primary mui-btn-block bc-head" onclick="submit()">提交报价</button>
              </div>`
            )
          }

      dsBridge.register('store', function () {
        collection();
      })


    })

    //收藏
    function collection() {
      var data = { type: 20, contentId: dataInfo.id, user: getUserId() }
      getServerData(url_storemng_store, data);
    }
    // 点击跳转
    function submit() {
      if (dataInfo != null && dataInfo.quoteStatus == 2) {
        showToast("不能重复报价");
        return;
      }
      dsBridge.call("quote", "");
    }

    function getServerDataSuccess(url, data) {
      switch (url) {
        //获取详情
        case url_trandemandmgr_queryDetail:
          dataInfo = data.data;
          dataInfo.tranType = dataInfo.tranType.name;
          for (var key in object) {
            $("#" + key).html(dataInfo[key]);
          }
          break;
        //收藏
        case url_storemng_store:
          showToast("收藏成功")
          break;
        default:
          break;
      }

    }


  </script>
</body>

</html>